<?php
declare (strict_types = 1);

namespace app\admin\model;

use think\Model;

/**
 * Class SystemConfig
 * @package app\admin\model
 */
class SystemConfig extends Model
{
    //
    public static function getBaseConfig(){
        $config = self::field('type,name,value')
            ->where('type','=','base')
            ->select()->toArray();
        $data = [];
        foreach ($config as $k => $v){
            $data[$v['name']] = $v['value'];
        }
        return $data;
    }
    public static function getAllConfig(){
        return self::field('id,name,content,type,value')->select();
    }
    public static function getConfigByID($id){
        return self::field('id,name,content,type,value')
            ->where('id','=',$id)
            ->find();
    }
}
